package com.company.service.impl;

import com.company.service.BaseService;
import com.company.service.StartService;
import com.company.utils.SericeFactory;

import java.util.List;
import java.util.Scanner;

public class StartServiceImpl implements StartService {


    @Override
    public void execute(List list) {
        Scanner sc = new Scanner(System.in);
        System.out.println("欢迎使用书虫阅读器");
        while (true){
            System.out.println("1、登录");
            System.out.println("2、注册");
            System.out.println("3、退出");
            System.out.println("请选择");
            int choice = sc.nextInt();
            switch (choice){
                case 1:
                    System.out.println("-----登录------");
                    BaseService baseService = SericeFactory.getService("login");
                    baseService.execute(list);
                    xiaoshuoImpl xiaoshuo = new xiaoshuoImpl();
                    xiaoshuo.liebiao(list);

                    break;
                case 2:
                    System.out.println("-----注册------");
                    BaseService baseService1 = SericeFactory.getService("regis");
                    baseService1.execute(list);

                    break;
                case 3:
                    System.exit(0);
                default:
                    System.out.println("输入有误");
            }

        }
    }
}
